CC=g++
CFLAGS=-std=c++0x -Wall
LIBFLAGS=-c

SPATH=System
HPATH=Headers
OPATH=Obj

all: lib.log lib.config lib.authr lib.utf8 lib.nsr module.ns module.us module.an module.ar module.ws module.gui

lib.log: $(SPATH)/log.cpp $(HPATH)/log.h
	$(CC) $(CFLAGS) $(LIBFLAGS) $(SPATH)/log.cpp -o Obj/log.o	-DLOGPATH=\"./journal\"

lib.config: $(SPATH)/config.cpp $(HPATH)/config.h
	$(CC) $(CFLAGS) $(LIBFLAGS) $(SPATH)/config.cpp -o Obj/config.o 

lib.authr: $(SPATH)/authr.cpp $(HPATH)/authr.h
	$(CC) $(CFLAGS) $(LIBFLAGS) $(SPATH)/authr.cpp -o Obj/authr.o

lib.utf8: $(SPATH)/utf8.cpp $(HPATH)/utf8.h
	$(CC) $(CFLAGS) $(LIBFLAGS) $(SPATH)/utf8.cpp -o Obj/utf8.o

lib.nsr: $(SPATH)/nsr.cpp $(HPATH)/nsr.h
	$(CC) $(CFLAGS) $(LIBFLAGS) $(SPATH)/nsr.cpp -o Obj/nsr.o

module.ns:
	@echo
	@echo '(+) Nameserver'
	$(MAKE) -f ./NS/Makefile

module.us:
	@echo
	@echo '(+) User storage'
	$(MAKE) -f ./USS/Makefile

module.gui: 
	@echo
	@echo '(+) Grpaphical User Interface'
	$(MAKE) -f ./GUI/Makefile

module.tui: 
	@echo
	@echo '(+) TUI'
	$(MAKE) -f ./TUI/Makefile

module.ws:
	@echo
	@echo '(+) Web-Server'
	$(MAKE) -f ./WS/Makefile

module.ar:
	@echo
	@echo '(+) Authorization'
	$(MAKE) -f ./AR/Makefile

module.an:
	@echo
	@echo '(+) Authentication'
	$(MAKE) -f ./AN/Makefile

test:
	@echo
	@echo '(+) Tests'
	$(MAKE) -f ./NS/Makefile test
	$(MAKE) -f ./USS/Makefile test
	$(MAKE) -f ./AN/Makefile test
	$(MAKE) -f ./AR/Makefile test
	$(MAKE) -f ./WS/Makefile test

clean:
	rm **/*.o
